{layout name="admin:layout" /}
<div id="actionbar">
    <div class="fn-left">
        <a href="{:url('system/admin.miniapp/authorizar',['types'=>0,'miniapp_id' => $miniapp_id])}" class="button{if $types == 0} button-green{/if}">正常</a>
        <a href="{:url('system/admin.miniapp/authorizar',['types'=>1,'miniapp_id' => $miniapp_id])}" class="button{if $types == 1} button-green{/if}">锁定</a>
    </div>
    <div class="fn-left">
        <form id="form" action="{:url('system/admin.miniapp/authorizar')}" method="get">
            <input type="hidden" name="types" value="{$types}" />
            <input type="hidden" name="miniapp_id" value="{$miniapp_id}" />
            <input placeholder="请输入用户手机号/应用名称" class="input w200" type="text" name="keyword" value="{$keyword}" />
            <input type="submit" value="搜索" class="button" />
        </form>
    </div> 
    <div class="fn-right">
        <a href="{:url('system/admin.miniapp/addAuthorizar')}" class="button button-blue"><i class="iconfont icon-add_icon"></i>增加</a>
    </div>
</div>
<table class="table table-border">
<thead>
    <tr>
        <th class="fn-tac w50">#</th>
        <th class="w210">管理</th>
        <th class="w120">手机号</th>
        <th class="w260">应用名称</th>
        <th class="w160 fn-tac">应用类型</th>
        <th class="w160">创建时间</th>
        <th>客户端ID</th>
        <th class="w70 fn-tac">状态</th>
    </tr>
</thead>
<tbody>
{foreach $list as $rs}
    <tr>
        <th class="fn-tac">{$rs->id}</th>
        <td class="button-group">
            <a class="button button-green" href="{:url('system/admin.member/manage',['id' => $rs->id])}"  target="_blank"><i class="iconfont icon-text_icon"></i>管理中心</a>
            <a class="button" href="{:url('system/admin.miniapp/editAuthorizar',['id'=>$rs->id])}"><i class="iconfont icon-edit"></i>设置</a>
        </td>
        <td>{$rs.phone_id}</td>
        <td>{$rs.appname}</td>
        <td class="fn-tac">
            {switch $rs.types}
            {case mp}<span class="badge bg-blue">公众号</span>{/case}
            {case program}<span class="badge bg-red">小程序</span>{/case}
            {case app}<span class="badge bg-yellow">APP</span>{/case}
            {case mp_program}<span class="badge bg-green">小程序/公众号</span>{/case}
            {case mp_program_app}<span class="badge bg-green">小程序/公众号/APP</span>{/case}
            {default /}<span class="badge">应用异常</span>
            {/switch}   
        </td>
        <td>{$rs.create_time|date='Y-m-d H:i'}</td>
        <td>{$rs.service_id}</td>
        <td class="fn-tac li">
            <a class="isLock" url="{:url('system/admin.miniapp/islockAuthorizar',array('id'=>$rs.id))}" href="javascript:;" title="锁定/解锁">
            {if $rs.is_lock}
                <span class="badge bg-red">锁定</span>
            {else}
                <span class="badge">正常</span>
            {/if}
            </a>
        </td>
    </tr>
{/foreach}
</tbody>
</table>
{$list|raw}
<script type="text/javascript">
Do('base','layer',function(){
    $('.isDel').isDel();
    $('.isLock').click(function () {
        var url = $(this).attr("url");
        parent.layer.confirm('确认要锁定当前用户?',{ icon: 3,title: '友情提示' }, function (index) {
            $.getJSON(url, function (data) {window.location.reload();});
            parent.layer.close(index);
        });
    })
})
</script>